/*
 * Copyright 2010    Sylvere RICHARD
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.infotrafficlux.server.controller;

import java.util.ArrayList;
import java.util.List;

import javax.validation.constraints.NotNull;

import com.google.infotrafficlux.server.bean.Segment;
import com.google.infotrafficlux.server.bean.UserPref;

public class NewUserPref {

	@NotNull
	private Long id;

	@NotNull
	private String email;
	
	private List<NewSegment> segments;

	public UserPref asUserPref() {
		
		return new UserPref(id, email, asList(segments));
	}

	private List<Segment> asList(List<NewSegment> seg) {
		List<Segment> ret = new ArrayList<Segment>(seg.size());
		for(NewSegment s : seg) {
			//ret.add(s.)
		}
		return ret;
	}

	public NewUserPref(Long id, String email, List<NewSegment> segments) {
		super();
		this.id = id;
		this.email = email;
		this.segments = segments;
	}

	public NewUserPref() {
		super();
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return the segments
	 */
	public List<NewSegment> getSegments() {
		return segments;
	}

	/**
	 * @param segments the segments to set
	 */
	public void setSegments(List<NewSegment> segments) {
		this.segments = segments;
	}
	
}
